package XPath;

import org.dom4j.Document;
import org.dom4j.Node;
import org.dom4j.io.SAXReader;
import org.junit.*;
import java.io.InputStream;
import java.util.List;

public class 全文搜索 {

    Document document;

    @Before
    public void vpbz() throws Exception{
        SAXReader saxReader = new SAXReader();
        InputStream inputStream = 全文搜索.class.getResourceAsStream("/xml/Contact.xml");
        document = saxReader.read(inputStream);
    }


    @Test
    public void sbso() {
        List<Node> nodes = document.selectNodes("//name");
        for (Node node : nodes) {
            System.out.println(node.getText());
        }
    }

    @Test
    public void sbso1() {
        List<Node> nodes = document.selectNodes("//concat/name");
        for (Node node : nodes) {
            System.out.println(node.getText());
        }
    }
}
